package nu.aing.P20140505;

/**
 * @author memekmaut@gmail.com
 */
public class LongWordsDiv2 {
    
    public static void main(String[] args) {
        System.out.println("AAA = " + find("AAA")); // Returns Dislikes
        System.out.println("ABCBA = " + find("ABCBA")); // Returns Likes
        System.out.println("ABCBAC = " + find("ABCBAC")); // Returns Dislikes
        System.out.println("TOPCODER = " + find("TOPCODER")); // Returns Likes
        System.out.println("VAMOSGIMNASIA = " + find("VAMOSGIMNASIA")); // Returns Dislikes
        System.out.println("SINGLEROUNDMATCH = " + find("SINGLEROUNDMATCH")); // Returns Likes
        System.out.println("DALELOBO = " + find("DALELOBO")); // Returns Likes
    }
    
    public static String find(String word) {
        
        char[] chars = word.toCharArray();
        char[] holder = new char[2];
        for(int i = 0; i < chars.length; i++) {
            holder[0] = chars[i];
            for(int j = i+1; j < chars.length; j++) {
                holder[1] = chars[j];
                
                boolean findX = false, findY = false;
                for(int k = j; k < chars.length; k++) {
                    if(!findX && holder[0] == chars[k]) {
                        findX = true;
                        continue;
                    }
                    
                    if(findX) {
                        if(holder[1] == chars[k]) {
                            findY = true;
                            break;
                        }
                    }
                }
                
                if(findX && findY) {
                    return "DisLikes";
                }
            }
        }
        
        return "Likes";
    }
}
